using System;
using System.Text;
using Com.ContentRendering.Api.ParserEngine.Exceptions;

namespace Com.ContentRendering.Api.ParserEngine.State
{
    /// <summary/>
    internal class ChildTagState : AbstractNameState
    {
        /// <summary/>
        internal ChildTagState(AbstractState state) : base(state) { }

        /// <summary/>
        protected override void ParseChildCharacter()
        {
            throw new TagNameInvalidException();
        }

        /// <summary/>
        protected override void ParseParentCharacter()
        {
            throw new TagNameInvalidException();
        }
        
        /// <summary/>
        protected override OutputNodeInterface AddSubstitutionTag()
        {
            return base._outputNode.AddChildSubstitutionTag(base._stringBuilder.ToString());
        }

        /// <summary/>
        protected override OutputNodeInterface AddTransparentTag()
        {
            return base._outputNode.AddChildTransparentTag(base._stringBuilder.ToString());
        }

        /// <summary/>
        protected override OutputNodeInterface AddIfTag()
        {
            return base._outputNode.AddChildIfTag(base._stringBuilder.ToString());
        }

        /// <summary/>
        protected override OutputNodeInterface AddIfNotTag()
        {
            return base._outputNode.AddChildIfNotTag(base._stringBuilder.ToString());
        }

        /// <summary/>
        protected override void AddOutputTag()
        {
            base._outputNode.AddChildOutputTag(base._stringBuilder.ToString());
        }
    }
}
